import { Api } from "./index";
import Url from "./url";
import { LoginDTO,SafeConfigDTO, UserInfoDTO} from "../interface/dto";
import { PlainObject } from "../interface/base";
import { LoginModel,PasswordModel, RecordResponse, CommonResponse,PlainResponse} from "../interface/xhr";

class LoginApi extends Api {
    public login (params: LoginModel) {
        return this.postBodyFun<RecordResponse<LoginDTO>>(Url.loginSecurity,params)
    }
    public changePassword (params: PasswordModel) {
        return this.getQueryFun<CommonResponse>(Url.changePassword, params)
    }
    public safeCofig (params:PasswordModel) {
        return this.getQueryFun<RecordResponse<SafeConfigDTO>>(Url.safeCofig, params)
    }
    public loginOut () {
        return this.getFun<PlainResponse<string>>(Url.loginOut)
    }
    public getLoginUser () {
        return this.getFun<RecordResponse<UserInfoDTO>>(Url.getLoginUser)
    }
}
export const loginApi = new LoginApi(Url.loginBaseUrl)